<template>
  <a-spin :spinning="spinning">
    <a-form-model
      ref="ruleForm"
      :model="form"
      :rules="rules"
      :label-col="labelCol"
      :wrapper-col="wrapperCol"
    >
      <a-form-model-item ref="name" label="名称" prop="name">
        <a-input v-model="form.name"  />
      </a-form-model-item>
      <a-form-model-item label="标识" prop="type">
        <a-input v-model="form.type" />
      </a-form-model-item>
      <a-form-model-item label="状态" prop="status">
        <a-switch v-model="form.status" checked-children="正常" un-checked-children="停用"  />
      </a-form-model-item>
      <a-form-model-item label="备注" prop="remark">
        <a-input v-model="form.remark" type="textarea" />
      </a-form-model-item>
      <a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
        <a-button type="primary" @click="submit('ruleForm')">
          修改
        </a-button>
      </a-form-model-item>
    </a-form-model>
  </a-spin>
</template>
<script>
import EditMixin from "@/mixins/basic/edit.js";
export default {
  name: "add",
  mixins: [EditMixin],
  props:{
      id:{
          type:String,
          default:""
      }
  },
  data() {
    return {
      detailUrl: "/system/dict/type/selectOne",
      editUrl: "/system/dict/type/updateOne",
      detailParams:{
          id:this.id
      }
    };
  },
  methods:{
      detailFormatData(res){
          res.data.status = res.data.status === 0
          return res.data
      },
      formatData(){
          return {
              status:(this.form.status?0:-1),
                id:this.form.id,
                name:this.form.name,
                remark:this.form.remark,
                type:this.form.type
          };
      }
  }
};
</script>
